function(initialize_mdl_set)

    # ===============
    # PARSE ARGUMENTS
    # ===============

    set(_oneValueArgs NAME)

    cmake_parse_arguments(PREFIX
        "${_options}"
        "${_oneValueArgs}"
        "${_multiValueArgs}"
        "${ARGN}")

    if(NOT PREFIX_NAME)
        message(FATAL_ERROR "Missing NAME option.")
    endif()

    # Set a global variable containing the name of the exported set
    set_property(GLOBAL PROPERTY SETNAME ${PREFIX_NAME})

    # Define the array containing the exported folders
    define_property(GLOBAL PROPERTY ${PREFIX_NAME}
        BRIEF_DOCS "Array with the path of the folders to export containing autogenerated code."
        FULL_DOCS "Array with the path of the folders to export containing autogenerated code.")
endfunction()

function(register_mdl)

    # ===============
    # PARSE ARGUMENTS
    # ===============

    set(_oneValueArgs MODELNAME)

    cmake_parse_arguments(PREFIX
        "${_options}"
        "${_oneValueArgs}"
        "${_multiValueArgs}"
        "${ARGN}")

    # ============================
    # SAVE IT IN A GLOBAL VARIABLE
    # ============================

    set(SIMULINK_MODELNAME ${PREFIX_MODELNAME})

    # Check if the global property SETNAME exists...
    get_property(EXIST_SETNAME GLOBAL PROPERTY SETNAME SET)
    if(NOT EXIST_SETNAME)
        message(FATAL_ERROR "SETNAME global property not found. Probably initialize_mdl_set was not called.")
    endif()
    # ... and read it
    get_property(SETNAME GLOBAL PROPERTY SETNAME)

    # Get the absolute path of the autogenerated folder
    get_filename_component(AUTOGENSOURCES_ABSPATH ${SIMULINK_MODELNAME}_grt_rtw ABSOLUTE)
    if (NOT EXISTS ${AUTOGENSOURCES_ABSPATH})
        message(FATAL_ERROR "Folder ${SIMULINK_MODELNAME}_grt_rtw not found.")
    endif()

    # Register the mdl by appending its name to the global property
    set_property(GLOBAL APPEND PROPERTY ${SETNAME} ${AUTOGENSOURCES_ABSPATH})

endfunction()